home *** CD-ROM | disk | FTP | other *** search
- ' Shown below is some sample code you can use to change certain printer settings.
- ' This code is intended as an example and is not supported by Microsoft.
-
- Type zwtDevModeStr
- rgb As String * 64
- End Type
-
- Type zwtDeviceMode
- dmDeviceName As String * 32
- dmSpecVersion As Integer
- dmDriverVersion As Integer
- dmSize As Integer
- dmDriverExtra As Integer
- dmFields As Long
- dmOrientation As Integer
- dmPaperSize As Integer
- dmPaperLength As Integer
- dmPaperWidth As Integer
- dmScale As Integer
- dmCopies As Integer
- dmDefaultSource As Integer
- dmPrintQuality As Integer
- dmColor As Integer
- dmDuplex As Integer
- End Type
-
- ' The routine reads the current printer device mode information for the szReport
- ' ('PrtDevMode' property) in to DevMode structure and overwrites the PaperSize field
- ' with the user defined paper size. The routine sets the width of the paper
- ' to the Label Width, and length of the paper to the one label height.
- ' the routine called only for the dot matrix mailing labels, and will work
- ' only if dot matrix printer setup as default printer.
- '
- Private Sub DotMxSetup (szReport As String)
- Dim dm As zwtDevModeStr
- Dim DevMode As zwtDeviceMode
-
- Const psUserDefined = 256 ' User defined PaperSize
- Const mmInInch = 254 ' mm in one inch
- Const dxExtra = 360
- Const dmAllFields = 26127 ' all fileds has been initialized
-
- If Not IsNull(Reports(szReport).PrtDevMode) Then
- dm.rgb = Reports(szReport).PrtDevMode ' read default device mode
- LSet DevMode = dm
- DevMode.dmFields = dmAllFields
- DevMode.dmPaperSize = psUserDefined
- DevMode.dmPaperLength = ((ptLabelSize.y + dxdySpace.y) / zwcTwipsInch) * mmInInch
- DevMode.dmPaperWidth = (((ptLabelSize.x + dxdySpace.x) * cItemsAcross + xLeftMargin + xRightMargin) / zwcTwipsInch) * mmInInch
- LSet dm = DevMode
- Reports(szReport).PrtDevMode = dm.rgb ' write new device mode
- End If
- End Sub